
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from "typeorm";
import { ColumnMetadata } from "typeorm/metadata/ColumnMetadata";

@Entity({ name: 'message' })
export class MessageEntity extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number;//消息id

    @Column({
        type: 'varchar',
        length: 300
    })
    content: string;//消息内容

    @Column({
        type: 'tinyint',
    })
    confirmRequired: number;//是否需要确认

    @Column({
        type: 'tinyint',
    })
    confirmRead: number;//是否已读

    @Column({
        type: 'datetime',
        nullable: true
    })
    readTime: string;//第一个用户读取时间


    @Column({
        type: 'tinyint'
    })
    messageChannel: 0 | 1 | 2 | 3 | 4 | 5; //0 系统消息 | 1 酒店消息 | 2 客房消息 | 3 用户消息 |  4 入住订单消息 | 5 商品订单消息

    @Column({
        type: 'int',
        default: 0
    })
    roomId: number;//房间id

    @Column({
        type: 'int'
    })
    hotelId: number;//酒店id

    @Column({
        type: 'int',
        default: 0
    })
    bookingOrderId: number;//预定订单id

    @Column({
        type: 'int',
        default: 0
    })
    fromUserId: number;//发送消息用户的id


    @Column({
        type: 'int',
        default: 0
    })
    confirmUserId: number;//确认者用户的Id

    @Column({
        type: 'datetime',
        nullable: true
    })
    confirmTime: string;//确认消息时间

    @Column({
        type: 'varchar',
        length: 300,
        default: ""
    })
    callbackContent: string;//回调内容

    @Column({
        type: 'int',
        default: 0
    })
    parentMessageId: number;//父节点消息id


    @Column({
        type: 'int',
        default: 0
    })
    firstReadUserId: number;//第一次读这条消息的用户

    @CreateDateColumn()
    gmtCreate: string;//消息创建时间

    @Column({
        type: 'int',
        default: 0
    })
    isDelete: 0 | 1;//删除标识 1.启用，0，禁用





}